<?php
namespace app\sys\controller;
use app\sys\model\InfoM;
use think\Db;
use think\Session;
use app\base\controller\Base;

class Index extends Base
{
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * 编辑页面
     * @param $id
     * @return mixed
     */
    public function info()
    {
        $id = 1;
        if($this->request->isPost())
        {
            $data = $this->request->post();
            $data['id'] = $id;
            $model = new InfoM();
            $res = $model->info($data);
            if($res)
            {
                $this->success('修改成功',url('sys/Index/info'));
            }
            else
            {
                $this->error($model->msg);
            }
        }
        //获取数据
        $data = Db::table('sys_info')->find($id);

        $this->assign(array(
            '_page_title'=>'站点设置',
            '_page_title_english'=>'SYS INFO',
            '_btn_title'=>'站点设置',
            '_btn_link'=>url('info'),
            '_page_ico'=>'iconfa-asterisk',
            'data'=>$data,
        ));
        return $this->fetch();
    }


}
